//
//  ReceivingAddressVC.m
//  BigJoy
//
//  Created by Rowling on 2017/7/7.
//  Copyright © 2017年 Rowling. All rights reserved.
//

#import "ReceivingAddressVC.h"
#import "AddressCell.h"
#import "AddressMangeVC.h"

@interface ReceivingAddressVC ()

@end

@implementation ReceivingAddressVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"收货地址";
    UIButton * btn = [UIButton new];
    [btn setTitle:@"新增" forState:UIControlStateNormal];
    btn.titleLabel.font = [UIFont systemFontOfSize:12];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:btn];
    [btn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [btn sizeToFit];
    @weakify(self);
    [[btn rac_signalForControlEvents:UIControlEventTouchUpInside] subscribeNext:^(__kindof UIControl * _Nullable x) {
        @strongify(self);
        // 新增
        AddressMangeVC * vc = [AddressMangeVC new];
        [self.navigationController pushViewController:vc animated:YES];
    }];
    [self.view addSubview:self.XMTableview];
    self.XMTableview.separatorStyle = 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 20;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    AddressCell * cell = [AddressCell cellWithTalbelView:tableView];
    if (indexPath.row == 1) {
        cell.isDefault = YES;
    }else {
        cell.isDefault = NO;
    }
    return cell;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 163;
}


@end
